home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Commodore Disk User Volume 4 #3
/
Commodore_Disk_User_Vol.4_3_1991_-.d64
/
aw-basic parser
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2022-10-26
|
1KB
|
51 lines
5 rem"[141][154]
100 [143] ********************************
110 [143] * very simple basic parser *
120 [143] * by jason finch *
130 [143] * *
140 [143] * enter command and it will be *
150 [143] * split (verb-noun form only.) *
160 [143] * *
170 [143] * check data at end for vocab. *
180 [143] ********************************
190 [141]500:[133]"loadprintwhat now";comm$:[143]"gosub
200 noun$="": verb$="": vb=0: no=0
210 l=len(comm$)
220 for x=1 to l
230 if mid$(comm$,x,1)=" " then x=l: goto 250
240 verb$=verb$+mid$(comm$,x,1)
250 next
260 v$=verb$:verb$=left$(v$,4)
270 f=0: for x=1 to nv
280 if verb$=vb$(x) then vb=x: f=1: x=nv
290 next: if f=1 then 320
300 vb=0: if v$=comm$ then 340
310 goto 330
320 if(len(v$)+1) >= len(comm$) then noun=0: goto 420
330 noun$=right$(comm$,l-1-len(v$))
340 n$=noun$:noun$=left$(n$,4)
350 f=0: for x=1 to nn
360 if no$(x)=noun$ then no=x: f=1:x=nn
370 next: if f=1 then 390
380 no=0: goto 420
390 goto 420:rem"[141][154]
400 :
410 :
420 [153] "sys verb: open"v$
430 [153] "sys noun: open"n$
440 [153]
450 [153] "sys verb number:open"vb
460 [153] "sys noun number:open"no
470 [153]:[153]:[153]"":[128]
480 :
490 :
500 [151]53280,5:[151]53281,11
510 nv[178]6: nn[178]4
520 [129] x[178]1 [164] nv: [135] vb$(x): [130]
530 [129] x[178]1 [164] nn: [135] no$(x): [130]
540 [142]
550 :
560 :
570 [131] get,drop,sear,look,eat,hit
580 [131] coin,key,door,appl